Functions List
3D Operations
• slice
The function slice
performs a section of a given
shape by a specified section plane. The section plane is specified by a point on the
plane and a vector that indicates what portion of the shape we wish to delete.
Parameters:
s – Shape to be sectioned
p – Point on section plane
v - Vector
Syntax:
(slice s [p (u0)] [v (uz)])
Example:
> (slice (sphere (xy 0 0) 1) (xy 0 0) (z 1))
#<slice 1>
• slice-with-surface
The function slice-with-surface
performs a section of a given
shape by a specified surface.
Parameters:
shape – Shape to slice
surface – Surface section
Syntax:
(slice-with-surface shape surface)
Example:
>(slice-with-surface (sphere (xyz 0 0 0) 10)
(surface-grid
(map-division
(lambda (u v)
(+xyz (u0) u v (* (sin u) (cos v))))
-10 10 20
-10 10 20)))
'(#<slice 2> #<slice 3>)
• extrusion
The function extrusion
performs an extrusion of a given shape
by specifying the extrusion direction or extrusion height. If the given shape is a curve the
end result will be a surface. If omitted, the extrusion height will be 1 and the extrusion
direction will be parallel to the Z axis. If the shape is a surface the result will be a solid.
The extrusion of extremely complex shapes is limited and specific to each CAD application.
Parameters:
shape – Shape to extrude (curve or surface)
h – Extrusion height
shape – Shape to extrude (curve or surface)
v – Extrusion direction
Syntax:
(extrusion shape [h 1])
(extrusion shape [v (uz)])
Example:
> (extrusion (surface-circle (xy 0 0) 1) 9)
#<extrusion 1>
> (extrusion (surface-circle (xy 0 0) 1) (xyz 2 3 9))
#<extrusion 1>
• sweep
The function sweep
performs an extrusion of a given
shape along a specified path (spline or polygonal line). In AutoCAD this operation can
take two additional parameters for changing the twist and scale along the extrusion.
The extrusion of extremely complex shapes is limited and specific to each CAD application.
Parameters:
p – Extrusion path (spline or polygonal line)
shape – Shape to extrude
t – Twist along a path
s – Scale change along path
Syntax:
(sweep p shape [t 0] [s 1])
Example:
> (sweep (arc (xy 0 0) 2) (surface-circle (xy 0 0)))
#<sweep 2>
> (sweep
(line (u0) (z 30))
(surface-polygon (xy -1 -1) (xy 1 -1) (xy 1 1) (xy -1 1))
2pi 2)
#<sweep 2>
• revolve
The function revolve
creates surfaces or solids of
revolution specified the shape to perform the revolution, two pint that define the
revolution axis, the initial angle and angle increment for the revolution. If omitted,
the first point of the revolution axis will be considered the UCS origin, the second
point will be considered immediately above the first one, the first angle 0 radians
and the angle increment 2π radians.
Parameters:
shape – Shape to revolve (curve or surface)
p1 – First point of revolution axis
p2 – Second point of revolution axis
a1 – Initial revolution angle
da – Angle increment for revolution
Syntax:
(revolve shape [p1 (u0)] [p2 (z 1)] [a1 0] [da 2pi])
Example:
> (revolve
(spline (xyz 0 0 2) (xyz 1 0 -1) (xyz 2 0 1)
(xyz 3 0 -1) (xyz 4 0 0) (xyz 5 0 -1))
(u0)
(uz)
(* 1/4 2pi) (* 3/4 2pi))
#<revolve 1>
• loft
The function loft
creates a smooth interpolation
of a number of given curves or surfaces. The interpolation of curves will produce
a surface and the interpolation of surfaces will produce a solid.
Parameters:
(list s1, s2, s3, s4, …, sn) – List of shapes for interpolation (curves or surfaces)
Syntax:
(loft (list s1 s2 s3 s4 … sn))
Example:
> (let ((circ0 (surface-circle (xyz 0 9 0) 4))
(circ1 (surface-circle (xyz 0 9 2) 2))
(circ2 (surface-circle (xyz 0 9 4) 3)))
(loft (list circ0 circ1 circ2)))
#<loft-surfaces 3>
• ruled-loft
The function ruled-loft
creates a ruled interpolation of a
number of given curves or surfaces. The interpolation of curves will produce a surface and
the interpolation of surfaces will produce a solid.
Parameters:
(list s1, s2, s3, s4, …, sn) – List of shapes for interpolation (curves or surfaces)
Syntax:
(ruled-loft (list s1 s2 s3 s4 … sn))
Example:
> (let ((circ0 (surface-circle (xyz 0 9 0) 4))
(circ1 (surface-circle (xyz 0 9 2) 2))
(circ2 (surface-circle (xyz 0 9 4) 3)))
(ruled-loft (list circ0 circ1 circ2)))
#<loft-surfaces 3>
• guided-loft
The function guided-loft
The function guided-loft creates
an interpolation of a number of given curves or surfaces with a greater level of control
by specifying a set of “guide” lines. The interpolation of curves will produce a surface
and the interpolation of surfaces will produce a solid.
Parameters:
(list s1, s2, s3, s4, …, sn) – List of shapes for interpolation (curves or surfaces)
(list g1, g2, g3, g4, …, gn) – List of guide lines
Syntax:
(guided-loft (list s1 s2 s3 s4 … sn) (list g1 g2 g3 g4 … gn))
Example:
(define (guides p0s p1s)
(if (null p0s)
(list)
(cons (line (car p0s) (car p1s))
(guides (cdr p0s) (cdr p1s)))))
> (guided-loft
(list
(surface-regular-polygon 6 (xyz 3 0 0) 1.0 0 #t)
(surface-regular-polygon 3 (xyz 3 0 5) 0.5 (/ pi 6) #t))
(guides
(regular-polygon-vertices 3 (xyz 3 0 0) 1.0 0 #t)
(regular-polygon-vertices 3 (xyz 3 0 5) 0.5 (/ pi 6) #t)))